package com.supreme.orderserver.service;

import com.supreme.commonmybatis.mapper.QualityMapper;
import com.supreme.commonentity.mysql.primary.BizQuality;
import com.supreme.commonboot.exception.BizException;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

@Service
public class QualityService {

    @Resource
    private QualityMapper qualityMapper;

    @Transactional(rollbackFor = BizException.class)
    public void createQuality(BizQuality quality) {
        if (quality.getQualityCode().equals("404")) {
            throw new BizException("qualityCode 404");
        }
        qualityMapper.insert(quality);
    }
}
